package cn.itsource.basic.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class AjaxResult {
    //成功状态
    private Boolean success=true;
    //提示信息
    private String message="OK";
    //状态码
    private String code=PetConstant.LJL_SUCCESS;
    //返回数据
    private Object data;

    //返回成功信息1
    public static AjaxResult createSuccess(){
        return new AjaxResult();
    }

    public static AjaxResult createSuccess(Object data){
        return new AjaxResult(true,"OK",PetConstant.LJL_SUCCESS,data);
    }

    //返回成功信息2
    public static AjaxResult createSuccess(String message,Object data){
        return new AjaxResult(true,"OK",PetConstant.LJL_SUCCESS,data);
    }


    //返回失败信息1
    public static AjaxResult createError(String message,String code){
        return new AjaxResult(false,message,null,code);
    }

    //返回失败信息1
    public static AjaxResult createError(String message){
        return createError(PetConstant.LJL_ERROR,message);
    }

}
